from functools import reduce

list_x = [1,2,3,4,5]

def square(x):
  return x * x
# range(5) [0,1,2,3,4]
res = map(lambda x,y:x*x+y, list_x, range(len(list_x)))

print(list(res))

# map 映射 循环处理列表，返回结果组成一个新列表

res2 = reduce(lambda x,y:x+y, list_x) # 把上次结果作为x，再次计算

print(res2)

res3 = filter(lambda x: True if x <= 3 else False, list_x)
print(list(res3))






